/**
 * @留言板
 */
import { request } from 'umi';

// 获取页面信息
export function getPageInformation() {
    return request('/api/page/2c1794cc-10d8-4d48-adda-7ff02371aee8/views',{
        method:"POST"
    });
}

// 获取页面上半部分评论内容
export function getCommentContent(page: number = 1, pageSize: number = 6) {
    //默认获取第一页六条数据
    return request(`/api/comment/host/2c1794cc-10d8-4d48-adda-7ff02371aee8?page=${page}&pageSize=${pageSize}`)
}

// 获取页面下班部分推荐阅读内容
export function getSuggestedReading() {
    return request('/api/article/recommend')
}
//发布评论
export function myRelease(id: string, content: string, url: string) {
    console.log(id,content,url);
    
    return request("/api/comment", { 
        method: "POST" ,
        data:{
            content,
            email:JSON.parse(localStorage.getItem("user")!).email,
            hostId:id,
            name:JSON.parse(localStorage.getItem("user")!).name,
            url
        }
    })
}

// {
//     content: "啊啊啊"
//     email: "qwertyui@qq.com"
//     hostId: "2c1794cc-10d8-4d48-adda-7ff02371aee8"
//     name: "高靖博之父"
//     url: "/page/msgboard"
// }